package com.wang.tool.webtool;

import com.wang.tool.common.result.SimpleResult;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Author wangshaopeng
 * @Date 2022/6/13
 */
public class SimpleWebErrorResponseBuilder implements WebErrorResponseBuilder {

    @Override
    public Object build4InternalError(SimpleResult<Void> defErrorResult, Throwable e, HttpServletRequest request, HttpServletResponse response) {
        //这里强写200,设想是服务端返回200,具体结果放在response里，自行判断
        response.setStatus(HttpServletResponse.SC_OK);
        return defErrorResult;
    }

    @Override
    public Object build4ErrorURI(SimpleResult<Void> defErrorUriResult, HttpServletResponse response) {
        return defErrorUriResult;
    }
}
